package pheromoneMap;

public enum PheromoneType {
	/*FORMAT: ENUM(decayRate, diffuseRate, coalesceRate, toStringName)*/
	
	/*
	 * Note:
	 * 
	 * Smaller numbers == faster rates.  A decayRate of 1 would be no decay whatsoever,
	 * while a decayRate of 0 would mean complete decay every round.  A decayRate of 0.5
	 * would represent the magnitude being halved each round.
	 * 
	 * Reasonable rates are in the range of 0.8 to 0.99, with some wiggle room...
	 */
	
	/***based on what the colony needs***/
	NEED_WOOD (0.9, 0.5, 1, "Need Wood"),
	/***harvesting resources***/
	TO_WOOD (0.99, 0.99, 0.9965, "To Wood"),
	/***Home***/
	TO_HOME (0.95, 0.9, 0.9965, "To Home"),
	/***based on what the colony needs***/
	NEED_GOLD (0.9, 0.5, 1, "Need Gold"),
	/***harvesting resources***/
	TO_GOLD (0.99, 0.99, 0.9965, "To Gold"),
	/***build a farm***/
	NEED_FARM(0.9, 0.5, 1, "Need Farm"),
	NEED_TOWER(0.9, 0.5, 1, "Need Tower"),
	/***build a barracks***/
	NEED_BARRACKS(0.8, 0.5, 1, "Need Barracks"),
	/***build a blacksmith***/
	NEED_BLACKSMITH(0.9, 0.5, 1, "Need Blacksmith"),
	/***build a lumbermill***/
	NEED_LUMBERMILL(0.9, 0.5, 1, "Need Lumbermill"),
	/***DONT BUILD NEAR ME BITCH***/
	GO_AWAY(0.90, 0.90, 1, "Go Away"),
	/***This is my territory***/
	MY_TERRITORY(0.80, 0.85, 1, "My Territory"),
	/***An enemy is here***/
	ENEMY(0.8, 0.5, 1, "Enemy"),
	/***DEATH***/
	DEATH(0.95, 0.3, 1, "Death");
	
	private double decayRate;
	private double diffuseRate;
	private double coalesceRate;
	private String name;
	
	PheromoneType(double decayRate, double diffuseRate, double coalesceRate, String name) {
		this.decayRate = decayRate;
		this.diffuseRate = diffuseRate;
		this.coalesceRate = coalesceRate;
		this.name = name;
	}

	/**
	 * @return the decayRate
	 */
	public double getDecayRate() {
		return decayRate;
	}

	/**
	 * @param decayRate the decayRate to set
	 */
	public void setDecayRate(double decayRate) {
		this.decayRate = decayRate;
	}

	/**
	 * @return the diffuseRate
	 */
	public double getDiffuseRate() {
		return diffuseRate;
	}

	/**
	 * @param diffuseRate the diffuseRate to set
	 */
	public void setDiffuseRate(double diffuseRate) {
		this.diffuseRate = diffuseRate;
	}

	/**
	 * @return the coalesceRate
	 */
	public double getCoalesceRate() {
		return coalesceRate;
	}

	/**
	 * @param coalesceRate the coalesceRate to set
	 */
	public void setCoalesceRate(double coalesceRate) {
		this.coalesceRate = coalesceRate;
	}
	
	public String toString() {
		return this.getName();
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}
	
	public static PheromoneType pheromoneTypeFromString(String name) {
		for (PheromoneType type : PheromoneType.values()) {
			if (type.getName().equals(name)) {
				return type;
			}
		}
		return null;
	}
}
